package com.xr.oa.remind;

import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.SqlDataset;
import com.bstek.dorado.common.*;
import com.xr.common.CommUtil;

/**
 * datasetRemindListener
 */
public class datasetRemindListener extends AbstractDatasetListener {
  public boolean beforeLoadData(Dataset dataset)
     throws Exception {
 String className = dataset.parameters().getString("className");
	  SqlDataset ds = (SqlDataset) dataset;
	  String sql="";
	  if(className.equalsIgnoreCase("due_datasetRemind")){
		   sql="select sts.sys_remind_sub_id,emp.employee_name,com.company_name,d.dept_name,d.dept_name_full,stu.modify_date,p.position_name,sts.remind_detail " +
		   		"from pb_sys_remind_sub  sts,pb_sys_remind_user stu,org_employee emp,org_company com, org_dept d,org_onoff_station  oos, pb_position p " +
		   		"where sts.sys_remind_user_id = stu.sys_remind_user_id " +
		   		"and emp.employee_id = sts.employee_id and oos.company_id = com.company_id " +
		   		"and oos.dept_id = d.dept_id and oos.position_id = p.position_id " +
		   		"and sts.onoff_station_id = oos.onoff_station_id and sts.state=1 " +
		   		"and stu.sys_remind_id ="+ds.parameters().getString("srId")+" and stu.employee_id="+CommUtil.getEmployeeId()+" ";
		   sql+=CommUtil.setConditionSQL(ds);
		  ds.setSql(sql);
	  }

    return true;
  }

}
